import Vue from 'vue'
import VueRouter from 'vue-router';
// import Home from '../views/Home.vue'
//此VueRouter是自己自定义引入暴露出来的，即是自定义的，以下的VueRouter同样是这样
// 解决两次访问相同路由地址报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)
const routes=[
    {
        path:'/',
        name:'Main',
        // redirect:'/home',
        component: () => import('../views/Main.vue'),
        // children: [
        //   {
        //     path: '/home',
        //     name: 'home',
        //     component:()=>import('../views/home')
        //   },
        //   {
        //     path: '/mall',
        //     name: 'mall',
        //     component:()=>import('../views/mall')
        //   },
        //   {
        //     path: '/user',
        //     name: 'user',
        //     component:()=>import('../views/User')
        //   },
         
        //       {
        //         path: '/page1',
        //         name: 'page1',
        //         component:()=>import('../views/other/pageOne.vue')
        //       },
        //       {
        //         path: '/page2',
        //         name: 'page2',
        //         component:()=>import('../views/other/pageTwo.vue')
        //       }
  
        // ]
    },
    {
      path:'/login',
      name:'login',
      component:()=>import('../views/Login/login.vue')
    }
    
]
const router = new VueRouter({
    mode:'history',
    routes

})
export default router